// Copyright (C) Kumo inc. and its affiliates.
// Author: Jeff.li lijippy@163.com
// All rights reserved.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published
// by the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program.  If not, see <https://www.gnu.org/licenses/>.
//

#pragma once

#include <nebula/types/meta/binary_type.h>

namespace nebula {

    /// \brief Concrete type class for variable-size string data, utf8-encoded
    class TURBO_EXPORT StringType : public BinaryType {
    public:
        static constexpr Type::type type_id = Type::STRING;
        static constexpr bool is_utf8 = true;
        using PhysicalType = BinaryType;

        static constexpr const char *type_name() { return "utf8"; }

        StringType() : BinaryType(Type::STRING) {}

        std::string to_string(bool show_metadata = false) const override;

        std::string name() const override { return "utf8"; }

    protected:
        std::string compute_fingerprint() const override;
    };

    /// \brief Concrete type class for variable-size string data, utf8-encoded
    class TURBO_EXPORT StringViewType : public BinaryViewType {
    public:
        static constexpr Type::type type_id = Type::STRING_VIEW;
        static constexpr bool is_utf8 = true;
        using PhysicalType = BinaryViewType;

        static constexpr const char *type_name() { return "utf8_view"; }

        StringViewType() : BinaryViewType(Type::STRING_VIEW) {}

        std::string to_string(bool show_metadata = false) const override;

        std::string name() const override { return "utf8_view"; }

    protected:
        std::string compute_fingerprint() const override;
    };

    /// \brief Concrete type class for large variable-size string data, utf8-encoded
    class TURBO_EXPORT LargeStringType : public LargeBinaryType {
    public:
        static constexpr Type::type type_id = Type::LARGE_STRING;
        static constexpr bool is_utf8 = true;
        using PhysicalType = LargeBinaryType;

        static constexpr const char *type_name() { return "large_utf8"; }

        LargeStringType() : LargeBinaryType(Type::LARGE_STRING) {}

        std::string to_string(bool show_metadata = false) const override;

        std::string name() const override { return "large_utf8"; }

    protected:
        std::string compute_fingerprint() const override;
    };
}  // namespace nebula
